<template>
    <div>
        <div id="shuju">
        <span class="el-icon-tickets"></span>
        <span> 数据列表</span>
      </div>
  <div class="wei">
        <Suptable
          :tableData="tableData"
          :headerData="headerData"
          :isPage="false"
        >
          <template v-slot:opera="{ row }">
            <div>
              <el-button
                type="text"
                @click="goShop('2', row.row.id, row.row)"
                size="small"
                >商品列表</el-button
              >
            </div>
          </template>
        </Suptable>
      </div>
    </div>
</template>
<script>
import Suptable from "@/components/Suptable";
import {sesGdNumList} from "@/api/sesGoodsMock.js"
import { sesList } from "@/api/sesMock.js";
import {GetCookie} from '@/config/config'
export default {
    name:"sesGoods",
    data(){
        return{
      
            pagenum:1,
            pagesize:1,
    tableData: [],
      headerData: [
        {
          prop: "id",
          label: "编号",
        },
        {
          prop: "name",
          label: "秒杀时段名称",
        },
        {
          prop: "startTime",
          label: "每日开始时间",
        },
        {
          prop: "endTime",
          label: "每日结束时间",
        },
         {
          prop: "num",
          label: "商品数量",
        },
      ],
        }
    },
mounted() {
     let _self =this
     _self.userList();
    setTimeout(()=>{
      _self.userLister();
    },100)
},
  methods:{
      goShop(type,id,row){
        let _self = this
        console.log(row);
         _self.$router.push({
                    name:'sesGoodShip',
                    params:{
                      cat_id:row.id,
                      nameId:GetCookie('nameid')
                    }
                })
      },
      userList() {
      let _self = this;
      let data = {
        pagenum: _self.pagenum, 
        pagesize: _self.pagesize,
      };
      sesList(data).then((res) => {
        console.log(res);
        if (res.meta.status == 200) {
          _self.tableData = [];
          _self.tableData = res.data._list;
          _self.total = res.data.total;
        }
      });
    },
      userLister(){
        let _self = this;
        let nameId = GetCookie('nameid')
        let data={
          nameId
        }
        sesGdNumList(data).then((res)=>{
            console.log(res);
            if(res.meta.status==200){
                for(let index in res.data.arr){
                  _self.tableData[index].num=res.data.arr[index].num
                }
            }
        })
    },
     
  
  },
   components: {Suptable },
}

</script>
<style scoped>
#shuju {
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #ebeef5;
  border-radius: 10px;
}
.right {
  float: right;
}
.clear {
  clear: both;
}
</style>